home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / tpapi.exe / EXAMPLES / CAPLPT.PAS < prev    next >
Pascal/Delphi Source File  |  1994-01-14  |  3KB  |  80 lines

  1. {***************************************************************************}
  2. {** Program : CAPLPT                                                      **}
  3. {***************************************************************************}
  4. {** Version : 1.0             ** Started :           ** Ended :           **}
  5. {***************************************************************************}
  6. {******************************** Description ******************************}
  7. {***************************************************************************}
  8. {** This will redirect LPT1 port to the first available print             **}
  9. {** queue on the default file server. Anything that is then written to    **}
  10. {** LPT1 is redirected to the print queue on the server.                  **}
  11. {**                                                                       **}
  12. {** For direct printing to a print queue see CAPQUEUE.                    **}
  13. {**                                                                       **}
  14. {**                                                                       **}
  15. {**                                                                       **}
  16. {***************************************************************************}
  17. {******************************** Information ******************************}
  18. {***************************************************************************}
  19. {**                                                                       **}
  20. {**                                                                       **}
  21. {**                                                                       **}
  22. {**                                                                       **}
  23. {***************************************************************************}
  24.  
  25. {$X+}
  26.  
  27. program CAPLPT;
  28.  
  29. uses
  30.  
  31.   nwvar,
  32.   nwerror,
  33.   nwbindry,
  34.   nwprint,
  35.   nwwrkstn,
  36.   nwmisc,
  37.   objects,
  38.   printer;
  39.  
  40. var
  41.  
  42.   Bindery    : BinderyOBJ;
  43.   Print      : PrintOBJ;
  44.   WorkStat   : WorkStationOBJ;
  45.   Misc       : MiscFuncOBJ;
  46.   CapFlags   : Capture_Flags;
  47.   QueueID    : OT_BinderyID;
  48.   Queues     : PStringCollection;
  49.   NoOfQueues : word;
  50.  
  51. begin
  52.  
  53.   Bindery.Init (true);
  54.   Print.Init (true);
  55.   WorkStat.Init (true);
  56.   Misc.Init (true);
  57.   Queues := new (PStringCollection, Init (5, 10));
  58.  
  59.   Misc.GetAllObjects ('*', OT_PrintQueue, Queues, NoOfQueues);
  60.   Bindery.GetBinderyObjectID (PString (Queues^.At (0))^, OT_PrintQueue, QueueID);
  61.   Print.GetDefaultCaptureFlags (CapFlags);
  62.   Print.SetCapturePrintQueue (0, WorkStat.GetDefaultConnectionID, QueueID);
  63.   Print.StartLPTCapture;
  64.  
  65.   {do all your printing to lpt1 here}
  66.  
  67.   rewrite (LST);
  68.   writeln (LST, 'THIS IS A TEST');
  69.  
  70.   Print.EndLPTCapture;
  71.   close (LST);
  72.   dispose (Queues, Done);
  73.   Bindery.Done;
  74.   Misc.Done;
  75.   Print.Done;
  76.   WorkStat.Done;
  77.  
  78. end.
  79.  
  80.